<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- qdoc-manual-contextcmds.qdoc -->
  <title>Relating Things | QDoc Manual 5.14.2</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.14</a></td><td ><a href="qdoc-index.html">QDoc Manual</a></td><td >Relating Things</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qdoc-index.html">Qt 5.14.2 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
  <link rel="prev" href="17-qdoc-commands-thread.html" />
  <link rel="next" href="19-qdoc-commands-grouping.html" />
<p class="naviNextPrevious headerNavi">
<a class="prevPage" href="17-qdoc-commands-thread.html">Thread Support</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="19-qdoc-commands-grouping.html">Grouping Things</a>
</p><p/>
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#commands">Commands</a></li>
<li class="level2"><a href="#inherits">\inherits</a></li>
<li class="level2"><a href="#overload">\overload</a></li>
<li class="level2"><a href="#reimp">\reimp</a></li>
<li class="level2"><a href="#relates">\relates</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Relating Things</h1>
<span class="subtitle"></span>
<!-- $$$18-qdoc-commands-relating.html-description -->
<div class="descr"> <a name="details"></a>
<p>The relating commands are for specifying how one documented element relates to another documented element. Some examples:</p>
<ul>
<li>This function is an overload of another function.</li>
<li>This function is a reimplementation of another function.</li>
<li>This typedef is <i>related</i> to some class or header file.</li>
</ul>
<p>There is also a command for documenting that a QML type inherits some other QML type.</p>
<a name="commands"></a>
<h2 id="commands">Commands</h2>
<a name="inherits-command"></a><a name="inherits"></a>
<h3 id="inherits">\inherits</h3>
<p>The \inherits command is for documenting that one QML type inherits some other QML type. It must be included in the inheriting element's <a href="13-qdoc-commands-topics.html#qmltype-command">\qmltype</a> comment. The argument is the name of the inherited QML type.</p>
<pre class="cpp">

  <span class="operator">/</span> <span class="operator">*</span><span class="operator">!</span>
      \qmltype PauseAnimation
      \instantiates <span class="type">QDeclarativePauseAnimation</span>
      \ingroup qml<span class="operator">-</span>animation<span class="operator">-</span>transition
      \since <span class="number">4.7</span>
      \inherits Animation
      \brief The PauseAnimation element provides a pause <span class="keyword">for</span> an animation<span class="operator">.</span>

      When used in a SequentialAnimation<span class="operator">,</span> PauseAnimation is a step
      when nothing happens<span class="operator">,</span> <span class="keyword">for</span> a specified duration<span class="operator">.</span>

      A <span class="number">500ms</span> animation sequence<span class="operator">,</span> with a <span class="number">100ms</span> pause between two animations:

      SequentialAnimation {
          NumberAnimation { <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> duration: <span class="number">200</span> }
          PauseAnimation { duration: <span class="number">100</span> }
          NumberAnimation { <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> duration: <span class="number">200</span> }
      }

      \sa {QML Animation and Transitions}<span class="operator">,</span> {declarative<span class="operator">/</span>animation<span class="operator">/</span>basics}{Animation basics example}
  <span class="operator">*</span> <span class="operator">/</span>

</pre>
<p>QDoc includes this line on the reference page for the <a href="../qtquick/qml-qtquick-pauseanimation.html">PauseAnimation</a> element:</p>
<blockquote><p>Inherits <a href="../qtquick/qml-qtquick-animation.html">Animation</a></p>
</blockquote>
<a name="overload-command"></a><a name="overload"></a>
<h3 id="overload">\overload</h3>
<p>The \overload command is for indicating that a function is a secondary overload of its name.</p>
<p>The command must stand on its own line.</p>
<p>For a function name that is overloaded (except constructors), QDoc expects one primary version of the function, and all the others marked with the <b>\overload command</b>. The primary version should be fully documented. Each overload can have whatever extra documentation you want to add for just that overloaded version.</p>
<p>You can include the function name plus '()' as a parameter to the <b>\overload</b> command, which will include a standard <i>This function overloads..&#x2e;</i> line of text with a link to the documentation for the primary version of the function.</p>
<pre class="cpp">

  <span class="operator">/</span> <span class="operator">*</span><span class="operator">!</span>
      \overload addAction()

      This convenience function creates a <span class="keyword">new</span> action with an
      \a icon and some \a text<span class="operator">.</span> The function adds the newly
      created action to the menu<span class="char">'s list of actions, and
      returns it.

      \sa QWidget::addAction()
  * /
  QAction *QMenu::addAction(const QIcon &amp;icon, const QString &amp;text)
  {
      QAction *ret = new QAction(icon, text, this);
      addAction(ret);
      return ret;
  }
  </span>

</pre>
<p>QDoc renders this as:</p>
<blockquote>        <h3><a href="http://doc.qt.io/qt-5/qaction.html">QAction</a>
        * QMenu::addAction ( const QIcon & <i>icon</i>,
        const QString & <i>text</i> )
        </h3>
        <p>This function overloads <a href="../qtwidgets/qmenu.html#addAction">addAction()</a></p>
<p>This convenience function creates a new action with an <i>icon</i> and some <i>text</i>. The function adds the newly created action to the menu's list of actions, and returns it.</p>
<p>See also <a href="../qtwidgets/qwidget.html#addAction">QWidget::addAction</a>().</p>
</blockquote>
<p>If you don't include the function name with the <b>\overload</b> command, then instead of the &quot;This function overloads..&#x2e;&quot; line with the link to the documentation for the primary version, you get the old standard line:</p>
<blockquote><p>This is an overloaded member function, provided for convenience.</p>
</blockquote>
<p>.</p>
<a name="reimp-command"></a><a name="reimp"></a>
<h3 id="reimp">\reimp</h3>
<p>The \reimp command is for indicating that a function is a reimplementation of a virtual function.</p>
<p>The command must stand on its own line.</p>
<p>QDoc will omit the reimplemented function from the class reference.</p>
<pre class="cpp">

  <span class="operator">/</span> <span class="operator">*</span><span class="operator">!</span>
      \reimp
  <span class="operator">*</span> <span class="operator">/</span>
  <span class="type">void</span> <span class="type"><a href="../qtwidgets/qtoolbutton.html">QToolButton</a></span><span class="operator">::</span>nextCheckState()
  {
      Q_D(<span class="type"><a href="../qtwidgets/qtoolbutton.html">QToolButton</a></span>);
      <span class="keyword">if</span> (<span class="operator">!</span>d<span class="operator">-</span><span class="operator">&gt;</span>defaultAction)
          <span class="type"><a href="../qtwidgets/qabstractbutton.html">QAbstractButton</a></span><span class="operator">::</span>nextCheckState();
      <span class="keyword">else</span>
          d<span class="operator">-</span><span class="operator">&gt;</span>defaultAction<span class="operator">-</span><span class="operator">&gt;</span>trigger();
  }

</pre>
<p>This function will not be included in the documentation. Instead, a link to the base function <a href="../qtwidgets/qabstractbutton.html#nextCheckState">QAbstractButton::nextCheckState</a>() will appear in the documentation.</p>
<a name="relates-command"></a><a name="relates"></a>
<h3 id="relates">\relates</h3>
<p>The \relates command is for including the documentation of a global element to some class or header file. The argument is a class name or header file.</p>
<pre class="cpp">

  <span class="operator">/</span> <span class="operator">*</span><span class="operator">!</span>
      \relates <span class="type"><a href="../qtcore/qchar.html">QChar</a></span>

      Reads a <span class="type">char</span> from the stream \a in into <span class="type">char</span> \a chr<span class="operator">.</span>

      \sa {Format of the <span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> operators}
  <span class="operator">*</span> <span class="operator">/</span>
  <span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> <span class="operator">&amp;</span><span class="keyword">operator</span><span class="operator">&gt;</span><span class="operator">&gt;</span>(<span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> <span class="operator">&amp;</span>in<span class="operator">,</span> <span class="type"><a href="../qtcore/qchar.html">QChar</a></span> <span class="operator">&amp;</span>chr)
  {
      <span class="type"><a href="../qtcore/qtglobal.html#quint16-typedef">quint16</a></span> u;
      in <span class="operator">&gt;</span><span class="operator">&gt;</span> u;
      chr<span class="operator">.</span>unicode() <span class="operator">=</span> <span class="type"><a href="../qtcore/qtglobal.html#ushort-typedef">ushort</a></span>(u);
      <span class="keyword">return</span> in;
  }

</pre>
<p>The documentation for this function will be included on the reference page for class <a href="../qtcore/qchar.html">QChar</a>.</p>
</div>
<!-- @@@18-qdoc-commands-relating.html -->
<p class="naviNextPrevious footerNavi">
<a class="prevPage" href="17-qdoc-commands-thread.html">Thread Support</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="19-qdoc-commands-grouping.html">Grouping Things</a>
</p>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2020 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
